using Circus.CodeEditor;
using System;
using System.ComponentModel;
using System.Drawing;
namespace Circus.Syntax.Lexer
{
	public class LexStyle
	{
		private string name = string.Empty;
		private string desc = string.Empty;
		private Color foreColor = Color.Empty;
		private Color backColor = Color.Empty;
		private FontStyle fontStyle = FontStyle.Regular;
		private bool plainText;
		private LexScheme scheme;
		private bool foreColorEnabled = true;
		private bool backColorEnabled = true;
		private bool boldEnabled = true;
		private bool italicEnabled = true;
		private bool underlineEnabled = true;
		[Description("Gets or sets name of the \"LexStyle\".")]
		public virtual string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					this.OnNameChanged();
				}
			}
		}
		[Description("Gets or sets a description of the \"LexStyle\".")]
		public virtual string Desc
		{
			get
			{
				return this.desc;
			}
			set
			{
				if (this.desc != value)
				{
					this.desc = value;
					this.OnDescChanged();
				}
			}
		}
		[Description("Gets or sets a foreground color of the \"LexStyle\".")]
		public virtual Color ForeColor
		{
			get
			{
				return this.foreColor;
			}
			set
			{
				if (this.foreColor != value)
				{
					this.foreColor = value;
					this.OnForeColorChanged();
				}
			}
		}
		[Description("Gets or sets a background color of the \"LexStyle\".")]
		public virtual Color BackColor
		{
			get
			{
				return this.backColor;
			}
			set
			{
				if (this.backColor != value)
				{
					this.backColor = value;
					this.OnBackColorChanged();
				}
			}
		}
		[Description("Gets or sets a font style of the \"LexStyle\".")]
		public virtual FontStyle FontStyle
		{
			get
			{
				return this.fontStyle;
			}
			set
			{
				if (this.fontStyle != value)
				{
					this.fontStyle = value;
					this.OnFontStyleChanged();
				}
			}
		}
		[Description("Gets or sets index of this \"LexStyle\" within the lexical style collection.")]
		public virtual int Index
		{
			get
			{
				return (this.scheme != null) ? this.scheme.Styles.IndexOf(this) : -1;
			}
		}
		[Description("Gets or sets value indicating whether Edit control should use text formatting rules, like checking spelling.")]
		public virtual bool PlainText
		{
			get
			{
				return this.plainText;
			}
			set
			{
				if (this.plainText != value)
				{
					this.plainText = value;
					this.OnPlainTextChanged();
				}
			}
		}
		[Description("Gets or sets \"ILexScheme\" that owns this \"LexStyle\".")]
		public LexScheme Scheme
		{
			get
			{
				return this.scheme;
			}
			set
			{
				this.scheme = value;
			}
		}
		public virtual bool ForeColorEnabled
		{
			get
			{
				return this.foreColorEnabled;
			}
			set
			{
				if (this.foreColorEnabled != value)
				{
					this.foreColorEnabled = value;
					this.OnForeColorEnabledChanged();
				}
			}
		}
		public virtual bool BackColorEnabled
		{
			get
			{
				return this.backColorEnabled;
			}
			set
			{
				if (this.backColorEnabled != value)
				{
					this.backColorEnabled = value;
					this.OnBackColorEnabledChanged();
				}
			}
		}
		public virtual bool BoldEnabled
		{
			get
			{
				return this.boldEnabled;
			}
			set
			{
				if (this.boldEnabled != value)
				{
					this.boldEnabled = value;
					this.OnBoldEnabledChanged();
				}
			}
		}
		public virtual bool ItalicEnabled
		{
			get
			{
				return this.italicEnabled;
			}
			set
			{
				if (this.italicEnabled != value)
				{
					this.italicEnabled = value;
					this.OnItalicEnabledChanged();
				}
			}
		}
		public virtual bool UnderlineEnabled
		{
			get
			{
				return this.underlineEnabled;
			}
			set
			{
				if (this.underlineEnabled != value)
				{
					this.underlineEnabled = value;
					this.OnUnderlineEnabledChanged();
				}
			}
		}
		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
	
		protected virtual void OnNameChanged()
		{
		}
		protected virtual void OnDescChanged()
		{
		}
		protected virtual void OnForeColorChanged()
		{
		}
		protected virtual void OnBackColorChanged()
		{
		}
		protected virtual void OnFontStyleChanged()
		{
		}
		protected virtual void OnPlainTextChanged()
		{
		}
		protected virtual void OnForeColorEnabledChanged()
		{
		}
		protected virtual void OnBackColorEnabledChanged()
		{
		}
		protected virtual void OnBoldEnabledChanged()
		{
		}
		protected virtual void OnItalicEnabledChanged()
		{
		}
		protected virtual void OnUnderlineEnabledChanged()
		{
		}
		public LexStyle()
		{
			this.foreColor = Consts.DefaultControlForeColor;
			this.backColor = Color.Empty;
		}
		public LexStyle(LexScheme scheme) : this()
		{
			this.scheme = scheme;
		}
		public virtual void Assign(LexStyle source)
		{
			this.name = source.Name;
			this.desc = source.Desc;
			this.foreColor = source.ForeColor;
			this.backColor = source.BackColor;
			this.fontStyle = source.FontStyle;
			this.plainText = source.PlainText;
			this.foreColorEnabled = source.ForeColorEnabled;
			this.backColorEnabled = source.BackColorEnabled;
			this.boldEnabled = source.BoldEnabled;
			this.italicEnabled = source.ItalicEnabled;
			this.underlineEnabled = source.UnderlineEnabled;
		}
		public virtual void ResetBackColor()
		{
			this.BackColor = Color.Empty;
		}
		public virtual void ResetForeColor()
		{
			this.ForeColor = Consts.DefaultControlForeColor;
		}
		public virtual void ResetFontStyle()
		{
			this.FontStyle = FontStyle.Regular;
		}
		public virtual void ResetPlainText()
		{
			this.PlainText = false;
		}
	}
}
